%% Stock Return Extrapolation, Option Prices, and Variance Risk Premium
% By Adem Atmaz
% This file generates Table 4: Parameter values
% Typically it takes less than 1 second to run

clear all;  clc;
format compact
format

% Fixed Parameter choices 
alpha=0.50;
theta=0.25;
rho=0;
r=0.0056;  % interest rate data from Beeler and Campbell 

% Fundamental variance mean reversion speed (kappa)
d_Ar1=0.70; % data on autocorrelation from Bollerslev et.al.(2009)
kappa=-log(d_Ar1);

% Fundamental variance long-run mean coefficient
d_Var_mean=0.1105^2;  % data from Beeler and Campbell 
zeta=kappa*d_Var_mean;

% Fundamental variance volatility term
d_RV_var=15.25*(12/10000); % Var of RV (Annualized) data  from Bollerslev et.al.
RV_B=(1-exp(-kappa/12))/(kappa/12); % Coefficent (B) of RV in eq 20 
vol_ratio_sq=2.11;  % ratio of stock volatility to fundamental volatility is 1.4526 and this is squared
sigma2=(2*kappa*kappa*d_RV_var)/(RV_B*RV_B*vol_ratio_sq*vol_ratio_sq*zeta);
sigma_temp=sqrt(sigma2);
sigma_upperbound=kappa/sqrt(1.75*2.75);
sigma=min(sigma_upperbound, sigma_temp)-0.0001;  

% Fundamental process mean growth rate
M_DELTA=((kappa+(rho*sigma)*(1+theta))^2)-((2+theta)*(1+theta)*sigma^2);
M_c=theta/(alpha*(1+theta));
M_b=-(2+theta)/(kappa+((rho*sigma)*(1+theta))+sqrt(M_DELTA));
mu=(r/(1+theta))-(zeta*M_b);
 
% Checking whether implied quantities economically plausible
if (M_b > 0)
    disp('Warning: Variance Elasticity b is positive!')
end
if ((kappa+(rho*sigma)*(1+theta))^2 - ((2+theta)*(1+theta)*sigma^2)< 0)
    disp('ERROR: b is not a real number!')
end

% Report quantities
alpha
theta
mu
kappa
zeta
sigma
rho
r

clear d_Ar1 d_r d_Var_mean d_RV_var
clear Con M_DELTA RV_B sigma2 sigma_temp sigma_upperbound

%% THE END